﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel;
using System.Text;
using System.Threading.Tasks;
using System.Net;
using AfvandingService.DOAs;

namespace AfvandingService
{
    /// <summary>
    /// Vores webservice interface.
    /// </summary>
    [ServiceContract]
    public interface ICentral
    {
        /// <summary>
        /// Opretter en pumpestation.
        /// </summary>
        /// <param name="pumpestationsnr"></param>
        /// <param name="netværksaddresse"></param>
        /// <param name="IP"></param>
        /// <param name="port"></param>
        /// <param name="vandstandsrisiko"></param>
        /// <param name="vandstand"></param>
        [OperationContract]
        void OpretPumpestation(int pumpestationsnr, string netværksaddresse, string IP, int port, string vandstandsrisiko, double vandstand);

        /// <summary>
        /// Sender besked til en pumpestation om, at den skal slette en bestemt pumpe
        /// </summary>
        /// <param name="pumpestationsnr"></param>
        /// <param name="pumpekapacitet"></param>
        /// <param name="pumpenr"></param>
        [OperationContract]
        void AnmodOpretPumpe(int pumpestationsnr, double pumpekapacitet, int pumpenr);

        /// <summary>
        /// Opdatérer en pumpestation
        /// </summary>
        /// <param name="pumpestationsnr"></param>
        /// <param name="netværksaddresse"></param>
        /// <param name="IP"></param>
        /// <param name="port"></param>
        /// <param name="vandstandsrisiko"></param>
        /// <param name="vandstand"></param>
        [OperationContract]
        void OpdatérPumpestation(int pumpestationsnr, string netværksaddresse, string IP, int port, string vandstandsrisiko, double vandstand);

        /// <summary>
        /// Sender besked til en pumpestation om at opdaterer en bestemt pumpe.
        /// </summary>
        /// <param name="pumpestation"></param>
        /// <param name="pumpe"></param>
        /// <param name="pumpekapacitet"></param>
        /// <param name="pumpenr"></param>
        [OperationContract]
        void AnmodOpdatérPumpe(int psnr, double pumpekapacitet, int pumpenr);

        /// <summary>
        /// Sletter en pumpestation
        /// </summary>
        /// <param name="pumpestationsnr"></param>
        [OperationContract]
        void SletPumpestation(int pumpestationsnr);

        /// <summary>
        /// Sender besked til en pumpestation om at slette en bestemt pumpe.
        /// </summary>
        /// <param name="pumpestationsnr"></param>
        /// <param name="pumpenr"></param>
        [OperationContract]
        void AnmodSletPumpe(int pumpestationsnr, int pumpenr);

        /// <summary>
        /// Returnerer én pumpestations aktuelle vandstand.
        /// </summary>
        /// <param name="pumpestationsnr"></param>
        /// <returns></returns>
        [OperationContract]
        double EnPSVandstand(int pumpestationsnr);

        /// <summary>
        /// Sender besked til en bestemt pumpe om at den skal starte.
        /// </summary>
        /// <param name="pumpenr"></param>
        /// <param name="pumpestationsnr"></param>
        /// <returns></returns>
        [OperationContract]
        bool AnmodStart(int pumpenr, int pumpestationsnr);

        /// <summary>
        /// Sender besked til en bestemt pumpe om at den skal stoppe.
        /// </summary>
        /// <param name="pumpenr"></param>
        /// <param name="pumpestationsnr"></param>
        /// <returns></returns>
        [OperationContract]
        bool AnmodStop(int pumpenr, int pumpestationsnr);

        /// <summary>
        /// Returnerer en liste med alle pumpestationers aktuelle vandstand.
        /// </summary>
        /// <returns></returns>
        [OperationContract]
        List<double> AllePSVandstande();

        /// <summary>
        /// Returnerer en liste af pumpestationer.
        /// </summary>
        [OperationContract]
        List<Pumpestation> PumpestationsListe();

        /// <summary>
        /// Returnerer en dictionary med alle vandstande og tidspunktet, hvor vandstanden var den mængde.
        /// </summary>
        /// <param name="pumpestationsNr"></param>
        /// <returns></returns>
        [OperationContract]
        Dictionary<double, DateTime> HentLog(int psnr);
    }
}
